/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.web.servlet;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface StaffBeanMapper {
    /**
     *
     * @param code
     * @param openid
     * @return
     */
    @Update("update tblstaff set openid = #{openid} where code = #{code}")
    Integer updateStaff(@Param("code") String code,@Param("openid")  String openid);


    @Update("update tblstaff set photo = #{photo} where code = #{code}")
    Integer updatePhoto(@Param("code") String code, @Param("photo") String photo);

    @Select("select photo from tblstaff where code = #{code}")
    String getPhoto(@Param("code") String code);

    @Select("select ifnull(is_open_common,0) from tblstaff where code = #{code}")
    Integer getIsOpenCommon(@Param("code") String code);


    @Update("update tblstaff set is_open_common = (case when #{isOpenCommon} then 1 else 0 end ) where code = #{code}")
    Integer updateOpenCommon(@Param("code") String code, @Param("isOpenCommon") Boolean isOpenCommon);
}
